<%@ include file="/taglibs.jsp"%>
<%@ page contentType="text/html;charset=UTF-8" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script src="${js}/jquery-1.6.min.js" type="text/javascript"></script>
<script src="${js}/ajaxfileupload.js" type="text/javascript"></script>
<title></title>
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
.STYLE1 {font-size: 12px}
.STYLE4 {
	font-size: 12px;
	color: #1F4A65;
	font-weight: bold;
}

a:link {
	font-size: 12px;
	color: #06482a;
	text-decoration: none;

}
a:visited {
	font-size: 12px;
	color: #06482a;
	text-decoration: none;
}
a:hover {
	font-size: 12px;
	color: #FF0000;
	text-decoration: underline;
}
a:active {
	font-size: 12px;
	color: #FF0000;
	text-decoration: none;
}
.STYLE7 {font-size: 12}

-->
</style>
<script type="text/javascript">
	function uploadtext() {
		$.ajaxFileUpload({
			//跟具updateP得到不同的上传文本的ID
	                 url:'${ctx}/put/uploadtxt',             //需要链接到服务器地址
	                 secureuri:false,
	                 fileElementId:'textfile',                         //文件选择框的id属性（必须）
	                 dataType: 'text',  
	                 success: function (data, status){  
	                 var data = eval("("+data+")"); 
	                 	var str = data.numtext;
	                 	str = str.replaceAll(",","\r\n");
						opener.document.getElementById("phone").value +=str; 
						alert('上传成功');
						opener.PhonesCount();
						window.close();
	                 },
	                 error: function (data, status, e){  
	                     alert('上传失败');
	                 }
	               }
	            );
	
	}
	
	String.prototype.replaceAll  = function(s1,s2){  
		return this.replace(new RegExp(s1,"gm"),s2);   //这里的gm是固定的，g可能表示global，m可能表示multiple。
	}
	
</script>

  </head>
  
  <body>
<form action="" id="form1" name="form1" encType="multipart/form-data">
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="30"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="15" height="30"><img src="${img}/tab_03.gif" width="15" height="30" /></td>
        <td width="1101" background="${img}/tab_05.gif"><img src="${img}/311.gif" width="16" height="16" /> <span class="STYLE4">上传号码</span></td>
        <td width="281" background="${img}/tab_05.gif"><table border="0" align="right" cellpadding="0" cellspacing="0">
        </table></td>
        <td width="14"><img src="${img}/tab_07.gif" width="14" height="30" /></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="9" background="${img}/tab_12.gif">&nbsp;</td>
        <td ><table width="100%" border="0.5" align="left" cellpadding="0" cellspacing="1" >
          <tr>
            <td width="100%" height="100" class="STYLE1"> 
           	 	  <input type="file" name="textfile" id="textfile" style="width: 300px" >&nbsp;&nbsp;
            </td>
          </tr>
        </table></td>
        <td width="9" background="${img}/tab_16.gif">&nbsp;</td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td height="29"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="15" height="29"><img src="${img}/tab_20.gif" width="15" height="29" /></td>
        <td background="${img}/tab_21.gif"><table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr align="center">
            <td width="25%" height="29" nowrap="nowrap"><input type="button" name="sbt"  value="上传" onclick="uploadtext();"/></td> 
          </tr>
        </table></td>
        <td width="14"><img src="${img}/tab_22.gif" width="14" height="29" /></td>
      </tr>
    </table></td>
  </tr>
</table>
</form>
</body>
</html>